1. Field of the Invention
The present invention relates to a method for generating a masking image using a general polygonal mask, and more particularly, to a method for generating the masking image using the general polygonal mask via determining relative locations between pixels and edges of the general polygonal mask.
2. Description of the Prior Art
Image masking refers to an image processing scheme that a certain region or an image mask is marked in an image to perform specific image processing or state configuration. The image processing, such as pixel values adjustment, and transparent, semi-transparent, opaque, and/or grid processing(s), may be performed to pixels inside the image mask, while pixels outside the image mask may remain the same or be processed with other image processing. As a result, a masking image may be generated by combining the pixels inside and outside the image mask.
In practice, image masking is widely used in surveillance systems for privacy protection and/or event detection. Please refer to FIG. 1, which illustrates a schematic diagram of a surveillance system 1. The surveillance system 1 includes one or more image capturing devices, a network video recorder (NVR)/digital video recorder (DVR), a monitor, and one or more user-end devices. The image capturing devices may be any kinds of surveillance cameras, such as Pan-Tilt-Zoom (PTZ) cameras, fixed cameras, System on Chip (SoC) image sensors, Digital Signal Processing (DSP) of Graphical Processing Units (GPUs) or Central Processing Units (CPUs), etc. The user-end devices may be a smart phone, a tablet computer, or a personal computer (PC), etc. The image capturing devices may connect to the NVR/DVR via a network hub or a network router. The NVR/DVR may further connect to a monitoring wall including a plurality of sub-monitors and the user-end devices via the Internet to instantly share captured images or videos to realize far-end monitoring.
For privacy protection, the surveillance system 1 may monitor and record scenes other than private regions; for example, the private regions may be masked to be invisible. For event detection in an enabled region of the image, the surveillance system 1 usually activates a record trigger or an event alarm by motion detection.
However, some regular variations happening in the enabled regions may cause a false alarm, for instance, braches and leaves swaying, traffic lights or other light sources changing. Therefore, one or more image masks are required to exclude the regular variations from the detected image to avoid the false alarm. In addition, the surveillance system 1 may achieve regular parameters configuration, different parameters (e.g. sensitivities) may be configured for the enabled region in the image, which also mitigates the false alarm.
The image mask or the enabled region of the image may have irregular, rectangular, or polygon shape to adapt to practical requirements. The image mask having the irregular shape may have a good flexibility to be suitable for complicated geometric conversion; however, memory buffer(s) may be required in order to perform the complicated geometric conversion, which leads to a larger hardware area as well as a high hardware cost. The image mask having the rectangular shape may have less flexibility but no memory buffer(s) is required to have a low hardware cost. The image mask having the polygon shape may have a middle flexibility compared with the irregular and rectangular shapes, the memory buffer(s) is optional, and thus a hardware cost for the polygonal image mask could be low or high.
Ideally, image masking shall be implemented on the front-end image capturing devices, the NVR/DVR and/or the user-end devices based on different levels of privacy protection and application requirements. However, since the memory buffer(s) brings the larger hardware area and the high hardware cost, only the image mask having the regular shape is implemental on the front-end image capturing devices, which limits a flexibility of the surveillance system 1.
Therefore, how to broaden the flexibility of the surveillance system 1 without the hardware limitation due to the memory buffer(s) has become a topic in the industry.